package unit17.urlConnection;

import java.net.URL;
import java.net.URLConnection;

public class URLConnectionTest {
	public static void main(String[] args) {
		try {
			String urlName;
			if(args.length>0) urlName=args[0];
			else urlName="http://horstmann.com";
			
			URL url=new URL(urlName);
			URLConnection connection=url.openConnection();
			
			if(args.length>2){
				String username=args[1];
				String password=args[2];
				String input=username+":"+password;
				String encoding=base64Encode(input);
				connection.setRequestProperty("Autorization", "Basic"+encoding);
			}
			connection.connect();
			
		} catch (Exception e) {
			// TODO: handle exception
		}
	}

	private static String base64Encode(String input) {
		// TODO Auto-generated method stub
		return null;
	}
}
